//
//  MonitorModel.m
//  CocoaAsyncSocketDemo
//
//  Created by 于鹏 on 2017/5/9.
//  Copyright © 2017年 于鹏. All rights reserved.
//

#import "MonitorModel.h"

@implementation MonitorModel
- (instancetype)init {
    if (self = [super init]) {
       
    }
    return self;
}


- (void)setPkgType:(PKGTYPE)pkgType {
    _pkgType = pkgType;
//    int baseSize = 14;
//    switch (pkgType) {
//        case pkg_0x20:{
//            XLLog(@"ECG1:%x",pkg_0x20);
//            NSData *hrData1 = [self.recivedData subdataWithRange:NSMakeRange(15+3, 2)];
//            XLLog(@"心率1:%@",hrData1);
//            break;
//        }
//        case pkg_0x21:{
//            XLLog(@"ECG2:%x",pkg_0x21);
//            NSData *hrData2 = [self.recivedData subdataWithRange:NSMakeRange(15+3, 2)];
//            XLLog(@"心率2:%@",hrData2);
//            break;
//        }
//        case pkg_0x22:{
//            XLLog(@"呼吸率:%x",pkg_0x22);
//            NSData *rrData = [self.recivedData subdataWithRange:NSMakeRange(15+1, 2)];
//            XLLog(@"呼吸率:%@",rrData);
//            break;
//        }
//        case pkg_0x0C:{
//            XLLog(@"血氧:%x",pkg_0x0C);
//            NSData *spo2Data = [self.recivedData subdataWithRange:NSMakeRange(15, 2)];
//            XLLog(@"血氧:%@",spo2Data);
//            break;
//        }
//        case pkg_0x0D:{
//            XLLog(@"血压:%x",pkg_0x0D);
////            //高压
////            NSData *sysData = [self.recivedData subdataWithRange:NSMakeRange(15, 2)];
////            XLLog(@"高压 :%@",sysData);
////            //平均血压
////            NSData *meaData = [self.recivedData subdataWithRange:NSMakeRange(15+5, 2)];
////            XLLog(@"平均血压 :%@",meaData);
////            //低压
////            NSData *diaData = [self.recivedData subdataWithRange:NSMakeRange(15+10, 2)];
////            XLLog(@"低压 :%@",diaData);
//            //高压
//            NSData *sysData = [self.recivedData subdataWithRange:NSMakeRange(15, 2)];
//            XLLog(@"高压 :%@",sysData);
//            //平均血压
//            NSData *meaData = [self.recivedData subdataWithRange:NSMakeRange(15+5, 2)];
//            XLLog(@"平均血压 :%@",meaData);
//            //低压
//            NSData *diaData = [self.recivedData subdataWithRange:NSMakeRange(15+10, 2)];
//            XLLog(@"低压 :%@",diaData);
//            break;
//        }
//        case pkg_0x0E:{
//            XLLog(@"体温:%x",pkg_0x0E);
//            //体温1
//            NSData *t1Data = [self.recivedData subdataWithRange:NSMakeRange(baseSize+1, 2)];
//            XLLog(@"体温1:%@",t1Data);
//            //体温2
//            NSData *t2Data = [self.recivedData subdataWithRange:NSMakeRange(baseSize + 2*5+1, 2)];
//            XLLog(@"体温2:%@",t2Data);
//            break;
//        }
//        default:
//            break;
//    }

}

@end

@implementation SendDataModel

- (id)initWithData:(NSData *)data type:(PKGTYPE)type waveDataModel:(SendWaveDataModel *)waveDataModel{
    self = [super init];
    if (self) {
        self.sendData = data;
        self.pkgType = type;
        self.waveDataModel = waveDataModel;
    }
    return self;
}
+ (id)modelWithData:(NSData *)data type:(PKGTYPE)type waveDataModel:(SendWaveDataModel *)waveDataModel {
    return [[self alloc]initWithData:data type:type waveDataModel:waveDataModel];
}
- (id)initWithData:(NSData *)data type:(PKGTYPE)type {
//    self = [super init];
//    if (self) {
//        self.sendData = data;
//        self.pkgType = type;
//    }
//    return self;
    return [self initWithData:data type:type waveDataModel:nil];
}

+ (id)modelWithData:(NSData *)data type:(PKGTYPE)type {
    return [[self alloc]initWithData:data type:type];
}
@end

@implementation SendWaveDataModel

@end
